package utils;

import android.content.Context;
import android.widget.Toast;

import constants.Constants;

/**
 * Created by Administrator on 2018/3/10.
 */

public class ToastUtil {

    private static Toast toast;

    public static void showToast(Context context, String content) {
        if (toast == null) {
            toast = Toast.makeText(context, content, Toast.LENGTH_SHORT);
        } else {
            toast.setText(content);
        }
        toast.show();
    }

    public static void showToastlog(Context context, String content) {
        if (Constants.CHECK_LOG) {
                toast = Toast.makeText(context, content, Toast.LENGTH_SHORT);
            toast.show();
        }
    }

    public static void hideToast(){
        if (toast != null ) {
            toast.cancel();
        }
    }
}
